// mapGen.h
// 03 October 2011
// Purpose: Header for MapGen class

#ifndef MAPGEN_H
#define MAPGEN_H

	struct Coordinate //coordinate struct which has an _x and _y value
	{
	int _x;//x position
	int _y;//y position
	};

class MapGen
{
public:
	MapGen();	// Default Constructor,creates a random maze of random size
	MapGen(int, int);					// Two Parameter Constructor, specifies height and width
	MapGen(int, int,int);	//with seed
	MapGen(int, int,int, int);	//with odds for 1's longer chains
	MapGen(int, int,int, int , int);	//with odds for loops
	MapGen(int, int,int, int , int,int); //with diffrent odds for the trunk
	int getW() const;//returns width of map
	int getH() const;//returns height of map

	Coordinate & getStart() const;//returns starting position of map

	Coordinate & getFinish() const;//returns finish position of map
	void displaymap();
	
	int getValue(int,int) const;//takes an index of x,y and returns the stored value

private:
	void initialize(int, int);
	void trunkGen(int); //seed
	void trunkGen2(int,int,int); //seed odds loops
	void branchGen(int,int);  //odds for 1's, loops
	bool branch(int , int); //x y
	bool branch(int,int,int);  //x y odds for 1's 
	bool branch(int,int,int,int);  //x, y, odds for 1's (1=never,2=50%,4=75%),allow loops (1=always, 2 =50%, 4=25%,8=12.5%) 
	struct Coordinate _start;//starting position of map
	struct Coordinate _finish;//finish position of map
	int _w;//width of maze
	int _h;//height of maze
	int ** _map;//2d array

	void setaround(int, int);
	int n	;
	int ne	;
	int e	;
	int se	;
	int s	;
	int sw	;
	int w	;
	int nw	;

};

#endif // MAPGEN_H
